<?php
$line = array('ID','Seller Name','Buyer Name','Product Title','Order Date','Sale Amount');
$csv->addRow($line);
foreach ($reports as $report):
    $totalammount='$'.$report['Order']['product_cost']*$report['Order']['quantity'];
	$line = array($report['Order']['id'],
	$report['Seller']['username'],
	$report['User']['username'],
	$report['Product']['products_title'],
	$report['Order']['add_date'],
        $totalammount
	);
	$csv->addRow($line);
        endforeach;
echo $csv->render('salesreport.csv');
?>